<%@include file="/common/include.jsp" %>
<%@include file="/common/import.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<%@include file="/common/head.jsp" %>
<BODY background="images/fondo_siscaa5.png" style="background-repeat: no-repeat;background-position:left top;">
<f:view>
	<%@include file="/common/menus.jsp" %>
	<h:form styleClass="frm">
	    <rich:tabPanel id="tabpantipusu" selectedTab="#{tipUsuController.tab}">
        <rich:tab name="tab1" label="Listar Tipos de usuarios">
            <table width="100%">
            <tr>
            <td>
                <rich:panel style="width:100%">
        		<f:facet name="header"><h:outputText value="Tipos de usuarios"/></f:facet>
			        <rich:dataTable width="100%" id="tipUsuList" rows="10" columnClasses="col"
			        onRowMouseOver="this.style.backgroundColor='#F8F8F8'"
        			onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
			            value="#{tipUsuController.lisTipUsu}" var="tipUsus">
			            <f:facet name="header">
			                <rich:columnGroup>
			                    <h:column>
			                        <h:outputText styleClass="headerText" value="Id" />
			                    </h:column>
			                    <h:column>
			                        <h:outputText styleClass="headerText" value="Descripcion" />
			                    </h:column>
			                </rich:columnGroup>
			            </f:facet>
			            <h:column>
			                <h:outputText value="#{tipUsus.id_tipoper}" />
			            </h:column>
			            <h:column>
			                <h:outputText value="#{tipUsus.desc_tipoper}" />
			            </h:column>
                	<a4j:support reRender="pantipusu,tabpantipusu" id="editar"
                    event="onRowClick">
		            	<a4j:actionparam name="descdep" value="#{tipUsus.desc_tipoper}" assignTo="#{tipUsuController.tipUsu.desc_tipoper}"/>
		            	<a4j:actionparam name="iddep" value="#{tipUsus.id_tipoper}" assignTo="#{tipUsuController.tipUsu.id_tipoper}"/>
		            	<a4j:actionparam name="tabdep" value="tab2" assignTo="#{tipUsuController.tab}"/>
		            	<a4j:actionparam name="msj" value="" assignTo="#{tipUsuController.msjguardarmsj}"/>
			        </a4j:support>
			        </rich:dataTable>
			        <rich:datascroller align="left" for="tipUsuList" maxPages="20"/>
    			</rich:panel>
            </td>
            </tr>
            <tr>
            <td>
            </td>
            </tr>
            </table>
        </rich:tab>
        <rich:tab name="tab2" label="Crear Tipo de Usuario" >
                <rich:panel id="pantipusu">
        		<f:facet name="header"><h:outputText value="Ingrese los datos"/></f:facet>
				<table width="100%">
				<tr><td colspan="2">
				<rich:toolBar height="20px" itemSeparator="grid">
			      <rich:toolBarGroup>
			      	  <a4j:commandLink action="#{tipUsuController.limpiarFormTipUsuAction}" reRender="tipUsuList, tabpantipusu">
			          <h:graphicImage value="images/iconNuevo.png" height="30" width="30"
			          style="border:0"/>
			            <rich:toolTip>
				            <h:outputText value="Nuevo"/>
				        </rich:toolTip>
			          </a4j:commandLink>
			          <a4j:commandLink action="#{tipUsuController.guardarTipUsu}" reRender="tipUsuList, tabpantipusu">
			          <h:graphicImage value="images/iconGuardar.png" height="30" width="30"
			          style="border:0"/>
			            <rich:toolTip>
				            <h:outputText value="Guardar"/>
				        </rich:toolTip>
			          </a4j:commandLink>
			      </rich:toolBarGroup>
			    </rich:toolBar></td></tr>
				<tr><td width="20%"><h:outputText value="Ingrese la descripcion:"/> </td>
				<td align="left"><h:inputText value="#{tipUsuController.tipUsu.desc_tipoper}" style="width: 300px"/></td></tr>
				<tr><td colspan="2">
				<h:outputText value="#{tipUsuController.msjguardarmsj}"
				style="font-family: Arial, Helvetica; color: green;"/></td></tr>
				</table>
    			</rich:panel>
        </rich:tab>
    </rich:tabPanel>
	</h:form>
</f:view>
</BODY>
</HTML>